Launch service from source
A guide explaining how to set up a Swipies AI service from its source code. By following this guide, you'll be able to debug using the source code.
Target audience
Developers who have added new features or modified existing code and wish to debug using the source code, provided that their machine has the target deployment environment set up.
Prerequisites
- CPU ≥ 4 cores
- RAM ≥ 16 GB
- Disk ≥ 50 GB
- Docker ≥ 24.0.0 & Docker Compose ≥ v2.26.1
If you have not installed Docker on your local machine (Windows, Mac, or Linux), see the Install Docker Engine guide.
Launch a service from source
To launch a Swipies AI service from source code:
Clone the Swipies AI repository
git clone https://github.com/infiniflow/Swipies AI.git
cd Swipies AI/
Install Python dependencies
-
Install uv:
pipx install uv -
Install Python dependencies:
uv sync --python 3.10 # install Swipies AI dependent python modulesA virtual environment named
.venvis created, and all Python dependencies are installed into the new environment.
Launch third-party services
The following command launches the 'base' services (MinIO, Elasticsearch, Redis, and MySQL) using Docker Compose:
docker compose -f docker/docker-compose-base.yml up -d
Update host and port Settings for Third-party Services
-
Add the following line to
/etc/hoststo resolve all hosts specified in docker/service_conf.yaml.template to127.0.0.1:127.0.0.1 es01 infinity mysql minio redis -
In docker/service_conf.yaml.template, update mysql port to
5455and es port to1200, as specified in docker/.env.
Launch the Swipies AI backend service
-
Comment out the
nginxline in docker/entrypoint.sh.# /usr/sbin/nginx -
Activate the Python virtual environment:
source .venv/bin/activate
export PYTHONPATH=$(pwd) -
Optional: If you cannot access HuggingFace, set the HF_ENDPOINT environment variable to use a mirror site:
export HF_ENDPOINT=https://hf-mirror.com -
Check the configuration in conf/service_conf.yaml, ensuring all hosts and ports are correctly set.
-
Run the entrypoint.sh script to launch the backend service:
JEMALLOC_PATH=$(pkg-config --variable=libdir jemalloc)/libjemalloc.so;
LD_PRELOAD=$JEMALLOC_PATH python rag/svr/task_executor.py 1;python api/Swipies AI_server.py;
Launch the Swipies AI frontend service
-
Navigate to the
webdirectory and install the frontend dependencies:cd web
npm install -
Update
proxy.targetin .umirc.ts tohttp://127.0.0.1:9380:vim .umirc.ts -
Start up the Swipies AI frontend service:
npm run devThe following message appears, showing the IP address and port number of your frontend service:
Access the Swipies AI service
In your web browser, enter http://127.0.0.1:<PORT>/, ensuring the port number matches that shown in the screenshot above.
Stop the Swipies AI service when the development is done
-
Stop the Swipies AI frontend service:
pkill npm -
Stop the Swipies AI backend service:
pkill -f "docker/entrypoint.sh"